<template>
  <div class="container flex self-start align-items-center border-box">
    <div class="flex justify-content-center align-items-center">
      <div class="pointer flex" @click="goHome">
        <img :src="Logo" style="width: 30px; margin: 0 15px" />
        <h2 class="mr-15 text-center" style="text-transform: uppercase">VueQuiz</h2>
      </div>
    </div>

    <div class="center flex align-items-center">
      <el-menu
        :default-active="route.meta.activeMenu ? route.meta.activeMenu : route.path"
        mode="horizontal"
        style="width: 100%"
        :router="true"
      >
        <el-menu-item index="/my-quiz">我的问卷</el-menu-item>
        <el-menu-item index="/materials">组件市场</el-menu-item>
      </el-menu>
    </div>

    <div class="right flex justify-content-center align-items-center">
      <DarkSwitch />
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter, useRoute } from 'vue-router';
import Logo from '@/assets/logo.svg';
import DarkSwitch from './DarkSwitch.vue';
const router = useRouter();
const route = useRoute();

const goHome = () => {
  router.push('/');
};
</script>

<style lang="scss" scoped>
.container {
  width: 100%;
  height: 60px;
  border-bottom: 1px solid var(--el-menu-border-color);
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--el-bg-color);
  z-index: 10;
  // .left {
  //   width: 60px;
  //   height: 100%;
  // }
  .center {
    flex: 1;
    height: 100%;
    // border-left: 1px solid var(--border-color);
    // border-right: 1px solid var(--border-color);
  }
  .right {
    width: 120px;
    height: 100%;
  }
}
</style>
